package file;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: xiaotutu
 * Date: 2025-03-04
 * Time: 21:06
 */
// Scanner读取文件
public class Demo8 {
    public static void main(String[] args) throws IOException {
        try (InputStream inputStream = new FileInputStream("c:/code/test.txt")) {
            // 此时就是从 test.txt 这个文件中读取数据了!!
            Scanner scanner = new Scanner(inputStream);
            String s = scanner.next();
            System.out.println(s);
        }

    }
}
